package com.stony.core.struts.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.taglib.TagUtils;

import com.stony.core.util.CoreUtils;

import javax.servlet.http.HttpServletRequest;


public class WriteHTMLTag extends TagSupport {

	protected String name;
	
	protected String property;
	
	protected String scope = null;

	public int doEndTag() throws JspException 
	{
		String str = CoreUtils.formatString(TagUtils.getInstance()
				.lookup(pageContext, name, property, scope));
		
		str = str.replaceAll(" ", "&nbsp;");
		str = str.replaceAll("\n", "<BR>");

		try {

			TagUtils.getInstance().write(pageContext, str);

		} catch (JspException e) {

			TagUtils.getInstance().saveException(pageContext, e);
			throw e;
		}

		return (EVAL_PAGE);
	}

	public int doStartTag() throws JspException {

		return (EVAL_BODY_INCLUDE);

	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getProperty() {
		return property;
	}

	public void setProperty(String property) {
		this.property = property;
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	/**
	 * Release all allocated resources.
	 */
//	public void release() {
//
//	}



}
